import { useContext } from "react";
import type { AcoAppProviderContext } from "~/contexts/app.js";
import { AcoAppContext } from "~/contexts/app.js";

export const useAcoApp = (): AcoAppProviderContext => {
    const context = useContext(AcoAppContext);

    if (!context) {
        throw new Error("useAcoApp must be used within a AcoAppContext");
    }

    return {
        app: context.app,
        folderIdPath: context.folderIdPath,
        folderIdInPath: context.folderIdInPath,
        model: context.model,
        client: context.client
    };
};
